home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 6577 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  458 b 

  1. Path: newshub.sdsu.edu!ucsnews!rohan!weikel
  2. From: weikel@rohan.sdsu.edu (weikel)
  3. Newsgroups: comp.lang.c++
  4. Subject: Mod or if?
  5. Date: 9 Feb 1996 18:25:58 GMT
  6. Organization: San Diego State University Computing Services
  7. Message-ID: <4fg3jm$fb8@gondor.sdsu.edu>
  8. NNTP-Posting-Host: 130.191.143.100
  9.  
  10. Which is better?
  11.  
  12. x = (x mod 7);
  13.  
  14. or
  15.  
  16. if (x == 7) x = 0; 
  17.  
  18. in terms of performance?  I know that the mod function is slow
  19. ,but the if method seems brute-forceish.
  20.  
  21.